<template>
  <div class="toast-container">
    <div
      v-for="toast in toasts"
      :key="toast.id"
      :class="['toast-message', toast.type]"
      :style="{ top: `${20 + toast.index * 70}px` }"
    >
      {{ toast.message }}
    </div>
  </div>
</template>

<script setup>
import { toasts } from '@/utils/toast'
</script>

<style scoped>
.toast-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.toast-message {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  padding: 15px 30px;
  border-radius: 25px;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  color: white;
  animation: slideDown 0.4s ease-out;
  transition: top 0.3s ease-in-out;
  margin-bottom: 10px;
}

.success {
  background: linear-gradient(135deg, rgba(25, 135, 84, 0.9), rgba(40, 167, 69, 0.8));
}

.error {
  background: linear-gradient(135deg, rgba(220, 53, 69, 0.9), rgba(255, 77, 79, 0.8));
}

@keyframes slideDown {
  0% {
    opacity: 0;
    transform: translate(-50%, -100%);
  }
  50% {
    transform: translate(-50%, 10px);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
</style>